<template>
  <div class="app-container">
    <el-form v-show="showSearch" :inline="true">
      <el-form-item label="回复状态" prop="replyStatus">
        <el-select :value="queryParams.replyStatus" @change="statusChange">
          <el-option label="未回复" value="NO">未回复</el-option>
          <el-option label="已回复" value="YES">已回复</el-option>
        </el-select>

      </el-form-item>
      <el-form-item label="单位名称">
        <el-input v-model="queryParams.unitName" placeholder="请输入单位名称" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="接收人名称">
        <el-input v-model="queryParams.unitPersonName" placeholder="请输入接收人名称" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="接收人电话">
        <el-input v-model="queryParams.personPhoneNo" placeholder="请输入接收人电话" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="会议标题">
        <el-input v-model="queryParams.msgTitle" placeholder="请输入会议标题" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>

      <el-form-item>
        <el-button @click="search" type="primary">搜索</el-button>
        <el-button @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="unitList">
      <el-table-column label="单位名称" align="left" prop="unitName" width="320" />
      <el-table-column label="会议标题" align="left" prop="msgTitle"/>
      <el-table-column label="接收人名称" align="center" prop="unitPersonName" />
      <el-table-column label="接收人电话" align="center" prop="personPhoneNo" />
      <el-table-column label="会议内容" align="left" prop="msgContent" />
      <el-table-column label="短信回执" align="left" prop="replyContent" />
      <el-table-column label="短信发送时间" align="left" prop="sendTime" />
      <el-table-column label="短信回复时间" align="left" prop="replyTime" />
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import { getReceipt } from "@/api/unit/unit";
import unitDetail from "@/common/unitDetail/unitDetail";
import Dialog from "./components/Dialog";
import DetailDialog from "@/common/detailDialog";
import MultiSet from "./components/MultiSet";

export default {
  name: "receipt",
  components: { unitDetail, Dialog, DetailDialog, MultiSet },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      unitList: [],
      // 单位信息表格数据
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        replyStatus:''
      },
      showSearch: true
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /**查询 */
    search() {
      this.getList();
    },
    /** 查询单位信息列表 */
    getList() {
      this.loading = true;
      getReceipt(this.queryParams)
        .then((response) => {
          this.unitList = response.rows;
          this.total = response.total;
        })
        .finally(() => (this.loading = false));
    },
    statusChange(value) {
      this.queryParams.replyStatus = value;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.replyStatus = "";
      this.queryParams.unitName = "";
      this.queryParams.unitPersonName = "";
      this.queryParams.personPhoneNo = "";
      this.queryParams.msgTitle = "";
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-table .cell {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

::v-deep .el-table .cell:hover {
  white-space: normal;
}

.on-going-project {
  font-size: 18px;
  color: #303133;
  padding-left: 10px;
}

.going-project-table {
  padding: 20px 30px;
}

.clickable {
  cursor: pointer;
}
</style>
